#include "gtest/gtest.h"

#include "SevenRecordTopic.h"

using namespace stream;
class ReaderTest : public testing::Test {
public:
    void SetUp() override{
        _7record  = new SevenRecordTopic();
    }
	void TearDown() override{
		delete _7record;
		_7record = nullptr;
	}
protected:
    SevenRecordTopic * _7record = nullptr;
};



#include "stream/Reader.h"
TEST_F(ReaderTest, testMock){
    size_t expect = 3; 
	auto impl = std::shared_ptr<Reader>(::stream::makeReaderMock(_7record->topic(), 0ull));
    size_t i = 0;
	while(impl->hasNext()){
        ++i;
		std::cout << *impl->current() << std::endl;
		impl->next();
	}
    ASSERT_EQ(i, expect);
}
TEST_F(ReaderTest, test){
	auto impl = std::shared_ptr<Reader>(::stream::makeReader(_7record->topic(), 0ull));
    size_t i = 0;
	while(impl->hasNext()){
        ++i;
		impl->next();
	}
    ASSERT_EQ(_7record->expectRecord(), i);
}
